#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>

int main()
{

  int ret=fork();
  if(ret<0)
  {
    perror("fork");
    return 1;
  }
  else if(ret==0)//子进程
  {
    while(1)
    {

     printf("I am  child .pid: %d ,  ppid:%d,ret: %d\n ",getpid(),getppid(),ret );
     sleep(1);    

  }
  }
  else//父进程
  {
    while(1)
    {  
    printf("I am father.pid: %d,ppid:%d,ret: %d\n",getpid(),getppid(),ret);

  
  sleep(1);

}
}

  return 0;
}
